package com.daoeping.action;

import java.sql.Timestamp;

import com.daoeping.data.Bzn_answer;
import com.daoeping.data.Bzn_question;
import com.daoeping.domain.JsonData;
import com.daoeping.domain.Page;
import com.daoeping.domain.TableData;
import com.daoeping.service.Bzn_answerService;
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;

public class Bzn_answerAction extends ActionSupport{
	private Bzn_answerService bzn_answerService;
	private Bzn_answer bzn_answer;
	private Page page;
	private TableData tableData;
	private JsonData jsonData;
	
	public Page getPage() {
		return page;
	}

	public void setPage(Page page) {
		this.page = page;
	}

	public TableData getTableData() {
		return tableData;
	}

	public void setTableData(TableData tableData) {
		this.tableData = tableData;
	}

	public JsonData getJsonData() {
		return jsonData;
	}

	public void setJsonData(JsonData jsonData) {
		this.jsonData = jsonData;
	}

	public Bzn_answer getBzn_answer() {
		return bzn_answer;
	}

	public void setBzn_answer(Bzn_answer bzn_answer) {
		this.bzn_answer = bzn_answer;
	}

	public Bzn_answerService getBzn_answerService() {
		return bzn_answerService;
	}

	public void setBzn_answerService(Bzn_answerService bzn_answerService) {
		this.bzn_answerService = bzn_answerService;
	}

	public String addBzn_answer(){
		bzn_answer.setCreateDatetime(new Timestamp(System.currentTimeMillis()));
		if(bzn_answerService.addBzn_answer(bzn_answer)){
			return "addBzn_answer";
		}else{
			return "exception";
		}
	}
	
	public  String findAllBzn_answerByPage(){
		Bzn_question bzn_question = (Bzn_question) ActionContext.getContext().getSession().get("question");
		jsonData = bzn_answerService.findAllBzn_answerByPage(page, tableData, bzn_question);
		System.out.println(jsonData.getJsonData());
		return "findAllBzn_answerByPage";
	}
}
